import java.util.Scanner;

public class Point {

    public static void main(String[] args) {
        System.out.println("输入评委人数");
        Scanner sc = new Scanner(System.in);
        int p = sc.nextInt();
        System.out.println("选手的最终得分: " + pointFor(p));
    }

    public static double pointFor(int p) {
        double[] arr = new double[p];
        Scanner sc = new Scanner(System.in);
        for(int i = 0; i < p; i++) {
            System.out.println("请输入第" + (i + 1) + "位评委的打分");
            arr[i] = sc.nextDouble();
        }
        double max = arr[0];
        double min = arr[0];
        double sum = 0;
        for (int i = 0; i < p; i++) {
            if(max < arr[i]) {
                max = arr[i];
            }
            if(min > arr[i]) {
                min = arr[i];
            }
            sum += arr[i];
        }
        return (sum - max - min) / (p - 2);
    }
}
